<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
#macro ( genericTree $somelist ) 
#foreach ( $some in $somelist )
<option value="$!some.id">#if($!some.level>0)
#foreach($count in [0..$!some.level])&nbsp;&nbsp;&nbsp;#end #end $!some.className</option>
#genericTree($some.childs) 
#end 
#end
<link href="$!webPath/resources/style/system/manage/$!{config.websiteCss}/template.css"  rel="stylesheet" type="text/css"/>
<script src="$!webPath/resources/js/jquery-1.8.3.min.js"></script>
<script src="$!webPath/resources/js/jquery.validate.min.js"></script>
<script src="$!webPath/resources/js/jquery.shop.common.js"></script>
<script src="$!webPath/resources/js/jquery.poshytip.min.js"></script>
<script>
jQuery(document).ready(function(){
//设置默认状态以及判断初始显示状态
	var state = jQuery("#display").val();
	if(state==""){
		jQuery("#display").val("true");
		jQuery("#displayOff").hide();
	}else{
		 if(state=="true"){
			jQuery("#displayOff").hide();
		}else{
			jQuery("#displayOn").hide();
		}
	}	
//
  jQuery("#theForm").validate({
    rules:{
	  title:{
	    required :true
	  }
	 },
	messages:{
	  title:{required:"导航标题不能为空"}
	}
  });
  //
  jQuery("#display_img").click(function(){
    var display=jQuery("#display").val();
	if(display=="true"){
	  jQuery("#display_img").attr("src","$!webPath/resources/style/system/manage/blue/images/no.jpg");
	  jQuery("#display").val("false");
	}else{
	  jQuery("#display_img").attr("src","$!webPath/resources/style/system/manage/$!{config.websiteCss}/images/yes.jpg");
	  jQuery("#display").val("true");
	}
  }); 	
  //
  jQuery("#new_win_img").click(function(){
    var new_win=jQuery("#new_win").val();
	if(new_win=="1"){
	  jQuery("#new_win_img").attr("src","$!webPath/resources/style/system/manage/blue/images/no.jpg");
	  jQuery("#new_win").val("0");
	}else{
	  jQuery("#new_win_img").attr("src","$!webPath/resources/style/system/manage/$!{config.websiteCss}/images/yes.jpg");
	  jQuery("#new_win").val("1");
	}
  }); 	  
  //
  jQuery(":radio[name='type']").click(function(){
      var type=jQuery(":radio[name='type']:checked").val();
      jQuery("select").hide();
      jQuery("#"+type+"_id").show();
	  if(type!="diy"){
	    jQuery("#url_set").hide();
	  }else  jQuery("#url_set").show();
	  if(type=="sparegoods"){
		  jQuery("#url_set").show();
		  jQuery("#ul_place").hide();
		  }
  });
  //
  jQuery(":radio[name='type'][value=$!obj.type]").attr("checked","checked");
  jQuery(":radio[name=location][value='$!obj.location']").attr("checked",true);
  #if($!obj.type=="goodsclass")
    jQuery("#goodsclass_id").show();
	jQuery("#goodsclass_id").val("$!obj.type_id");
  #end
  #if($!obj.type=="articleclass")
    jQuery("#articleclass_id").show();
	jQuery("#articleclass_id").val("$!obj.type_id");
  #end
  #if($!obj.type=="activity")
    jQuery("#activity_id").show();
	jQuery("#activity_id").val("$!obj.type_id");
  #end
  #if($!obj.type=="sparegoods")
   jQuery("#ul_place").hide();
  #end
});

function saveForm(){
 var type=jQuery(":radio[name='type']:checked").val();
 var type_id=jQuery("#"+type+"_id");
 jQuery("#type_id").val(type_id);
 jQuery("#theForm").submit();
}
</script>
</head>
<body>
<div class="cont">
  <h1 class="seth1">页面导航</h1>
  <div class="settab"><span class="tab-one"></span> <span class="tabs"> <a href="$!webPath/admin/navigation_list.htm">管理</a> | <a href="$!webPath/admin/navigation_add.htm" #if(!$!edit)class="this"#end>新增</a> #if($!edit) <a href="javascript:void(0);" class="this">编辑</a> #end </span> <span class="tab-two"></span></div>
  <form name="theForm" id="theForm" action="$!webPath/admin/navigation_save.htm" method=post>
    <input name="id" type="hidden" id="id" value="$!obj.id" />
    <input name="currentPage" type="hidden" id="currentPage" value="$!currentPage" />
    <input name="list_url" type="hidden" id="list_url" value="$!webPath/admin/navigation_list.htm" />
    <input name="add_url" type="hidden" id="add_url" value="$!webPath/admin/navigation_add.htm" />
    <div class="setcont">
      <ul class="set1">
        <li><strong class="orange fontsize20">*</strong>导航类型
          <input name="type_id" type="hidden" id="type_id" value="$!obj.type_id" />
        </li>
        <li>
          <input name="type" type="radio" value="diy" style="border:none;width:16px;height:16px;"/>
          自定义类型 </li>
        <li>
          <input name="type" type="radio" value="goodsclass" style="border:none;width:16px;height:16px;"/>
          商品导航
          <select name="goodsclass_id" id="goodsclass_id"  style="display:none;">
            
            
		 #genericTree($!gcs)
         
          
          </select>
        </li>
        <li>
          <input name="type" type="radio" style="border:none;width:16px;height:16px;" value="articleclass"/>
          文章导航
          <select name="articleclass_id" id="articleclass_id"  style="display:none;">
            
            
          #foreach($ac in $acs)
		   
            
            <option value="$!ac.id">$!ac.className</option>
            
            
		   #foreach($ac1 in $ac.childs)
		   
            
            <option value="$!ac1.className">&nbsp;&nbsp;$!ac1.className</option>
            
            
		   #end
		 #end

          
          </select>
        </li>
        <li>
          <input name="type" type="radio" style="border:none;width:16px;height:16px;" value="activity"/>
          活动导航
          <select name="activity_id" id="activity_id" style="display:none;">
          #foreach($activity in $activitys)
          <option value="$!activity.id">$!activity.ac_title</option>
          #end
          </select>
        </li>       
        <li> 
          <input name="type" type="radio" value="sparegoods" style="border:none;width:16px;height:16px;" />
         闲置导航       
        </li>
      </ul>
      <ul class="set1">
        <li><strong class="orange fontsize20">*</strong>导航标题</li>
        <li><span class="webname">
          <input name="title" type="text" id="title" value="$!obj.title" size="40" />
          </span></li>
      </ul>
      <ul class="set1" id="url_set">
        <li>导航URL</li>
        <li><span class="webname">
          <input name="url" type="text" id="url" value="$!obj.url" size="40" #if($!obj.sysNav==true) readonly="readonly"#end />
          站外导航请加http://
        </span></li>
      </ul>
      <ul class="set1" id="ul_place">
        <li>导航位置</li>
        <li>
          <input name="location" type="radio" style="border:none;width:16px;height:16px;" value="-1"/>
          顶部
          <input name="location" type="radio" style="border:none;width:16px;height:16px;" value="0"/>
          中间
          <input name="location" type="radio" style="border:none;width:16px;height:16px;" value="1"/>
          底部 
          </li>
      </ul>
      <ul class="set1">
        <li>显示</li>
        <li>
          <input name="display" id="display" type="hidden" value="$!obj.display" >
          <img #if($!obj.display)src="$!webPath/resources/style/system/manage/$!{config.websiteCss}/images/yes.jpg"#else src="$!webPath/resources/style/system/manage/blue/images/no.jpg"#end width="61" height="23" id="display_img" style="cursor:pointer"/> </li>
      </ul>
      <ul class="set1">
        <li>新窗口打开</li>
        <li>
          <input name="new_win" id="new_win" type="hidden" value="$!obj.new_win" >
          <img #if($!obj.new_win==1)src="$!webPath/resources/style/system/manage/$!{config.websiteCss}/images/yes.jpg"#else src="$!webPath/resources/style/system/manage/blue/images/no.jpg"#end width="61" height="23" id="new_win_img" style="cursor:pointer"/> </li>
      </ul>
      <ul class="set1">
        <li>序号</li>
        <li><span class="webname">
          <input name="sequence" type="text" id="sequence" value="$!obj.sequence" size="40" />
          </span></li>
      </ul>
    </div>
  </form>
  <div class="submit">
    <input name="save" type="button" value="提交" onclick="saveForm()" />
  </div>
</div>
</body>
</html>
